package com.anghui.demo.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SnowflakeConfig {
    @Value("${snowflake.work-id}")
    private long workId;
    @Value("${snowflake.data-center-id}")
    private long dataCenterId;

    @Bean
    public Snowflake snowflake() {
        return new Snowflake(workId, dataCenterId);
    }
}
